<?php


namespace app\admin\model;

use think\Model;

class Veridisk extends Model
{
    //markdown
    public function sendMsgMarkdown($token){
        // 机器人hook地址，access_token需要更换成自己的token哦！
        $webhook = config('ding')['webHook'];
        $keyword = config('ding')['keyWord'];
        $message = "
            ### {$keyword} disk-token
            ~~~
            {$token}
            ~~~
        ";
        $message = preg_replace("/^\h+/mu", '', $message);
        $atMobile = ['18792779949'];
        $atUserIds = ['0109541105777953'];
        $isAtAll = false;
        // markdown通知
        $data = [
            'msgtype'  => 'markdown',
            'title'    => '',
            'markdown' => [
                'title' => '注册用户信息',
                'text'  => $message,
            ],
            // 是否艾特全体成员 true 是
            'at'       => [
                'atMobiles' => $atMobile,
                'atUserIds' => $atUserIds,
                'isAtAll' => $isAtAll,
            ],

        ];
        $data_string = json_encode($data);

        $result = request_by_curl($webhook, $data_string);
        //echo $result;
        return true;
    }
}
